import {createBrowserRouter} from 'react-router-dom'
import App from '../App'

const routes=createBrowserRouter([
    {
        path:'/',
        element:<App/>,
        children:[
            {
                path:'index',
               
                lazy:async()=>{
                    const {default:Index}=await import('../pages/index/Index')
                    return{
                        element:<Index/>
                    }
                }
            },
            {
                path:'order',
                lazy:async()=>{
                    const {default:Order}=await import('../pages/order/Index')
                    return{
                        element:<Order/>
                    }
                }
            },
            {
                path:'message',
                lazy:async()=>{
                    const {default:Message}=await import('../pages/message/Index')
                    return{
                        element:<Message/>
                    }
                }
            },
             {
                path:'my',
                lazy:async()=>{
                    const {default:My}=await import('../pages/my/Index')
                    return{
                        element:<My/>
                    }
                },
                children:[
                     {
                        path:'myy',
                        lazy:async()=>{
                            const {default:Myy}=await import('../pages/my/myy/Index')
                            return{
                                element:<Myy/>
                            }
                        }
                    },
                ]
            },
        ]
    },
    {
        path:'login',
        lazy:async()=>{
            const {default:Login}=await import('../pages/login/Index')
            return{
                element:<Login/>
            }
        }
    },
    {
        path:'*',
        lazy:async()=>{
            const {default:Error}=await import('../pages/404/Index')
            return{
                element:<Error/>
            }
        }
    }
])
export default routes